package com.zzyl.nursing.controller.member;


import com.zzyl.common.core.controller.BaseController;
import com.zzyl.common.core.domain.R;
import com.zzyl.common.core.page.TableDataInfo;
import com.zzyl.nursing.domain.NursingProject;
import com.zzyl.nursing.service.MemberNPService;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


@Api(tags = "小程序端护理项目")
@RestController
@RequestMapping("/member/orders/project")
public class MemberNPController extends BaseController {

    @Autowired
    private MemberNPService memberNPService;


    /**
     * 分页查询护理项目列表
     *
     * @param nursingProject
     * @return
     */
    @GetMapping("/page")
    public TableDataInfo<List<NursingProject>> selectProjectPage(NursingProject nursingProject) {
        startPage();
        List<NursingProject> projectList = memberNPService.selectProjectPage(nursingProject);

        return getDataTable(projectList);
    }

    @GetMapping("/{id}")
    public R<NursingProject> getProjectById(@PathVariable Long id) {
        NursingProject oneProject = memberNPService.getById(id);

        return R.ok(oneProject);
    }


}
